package ArrayListDemo;

import java.util.ArrayList;

public class demo1 {
    public static void main(String[] args) {
        //创建集合对象,<>泛型
        ArrayList <String> list = new ArrayList<>();
        //添加元素
        boolean flag = list.add("123");
        list.add("456");
        list.add("789");
        System.out.println(flag);//true
        System.out.println(list);
        //删除
        String deletestr = list.removeFirst();
        System.out.println(list);
        System.out.println(deletestr);
        //改
        list.set(0,"aaa");
        //查
        String demo = list.get(1);
        System.out.println(demo);
        System.out.println(list);
        System.out.println(list.size());
        for (String s : list) {
            System.out.println(s);
        }
    }
}
